// 统一管理用户相关的接口
import request from "@/utils/request";
import type { CodeType } from "./type";
// 统一管理接口
enum API {
    GETCODE_URL = "/notNeed/getCode",
    GETEMAILAUTH_URL = "/need/user/getEmailAuth",
    UPDATEEMAIL_URL = "/need/user/updateEmail",
}

// 请求验证码
export const reqCode = (data: { email: string; type: CodeType }) => {
    return request.post<any, ResponseData>(API.GETCODE_URL, data);
};

// 获取邮箱权限
export const reqEmailAuth = (data: { email: string; code: string }) => {
    return request.post<any, ResponseData>(API.GETEMAILAUTH_URL, data);
};

// 修改邮箱
export const reqUpdateEmail = (data: { email: string; code: string }) => {
    return request.post<any, ResponseData>(API.UPDATEEMAIL_URL, data);
};
